 


using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Browser;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;
using Lib.Helper;
using MSIACCSL2.ViewModels;
using WcfService1.DTO;

namespace MSIACCSL2.Views.PurchaseOrder
{
    public partial class Index : Page
    {
        public PurchaseOrderViewModel VM
        {
            get { return (PurchaseOrderViewModel)this.DataContext; }
        }

        public PurchaseOrderWrapViewModel WMW
        {
            get { return (this.Resources["POW"] as PurchaseOrderWrapViewModel); }
        }

        public Index()
        {
            InitializeComponent();
            PurchaseOrderViewModel.OnSearchCompleted = (x) =>
                                          {
                                              this.DataContext = (PurchaseOrderViewModel)x;
                                          };
        }

        private void btnPrint_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            var po = (sender as Button).DataContext as PurchaseOrderDTO;
            //GlobalVar.OkaSocket.SendMessage("PurchaseOrder|" + po.PONumber);
            MyButton button = new MyButton(GlobalVar.ReportUrl + "PO.aspx?no=" + HttpUtility.UrlEncode(po.PONumber));
            button.ClickMe();
        }

        private void btnSend_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            VM.SendEmail((sender as Button).DataContext);
        }

    
    }
}


